import { createRouter, createWebHistory } from 'vue-router'
import LayoutView from '@/views/LayoutView.vue'
import LoginView from '@/views/LoginView.vue'

// 页面组件
import Index from '../views/pages/Index.vue';
import SystemUser from '../views/pages/SystemUser.vue';
import NormalUser from '../views/pages/NormalUser.vue';
import Announcement from '../views/pages/Announcement.vue';
import CompanyVue from '../views/pages/CompanyVue.vue';
import CourseCategory from '../views/pages/CourseCategory.vue';
import CourseList from '../views/pages/CourseList.vue';
import CourseReview from '../views/pages/CourseReview.vue';
import Consultant from '../views/pages/Consultant.vue';
import ConsultantLevel from '../views/pages/ConsultantLevel.vue';
import Expertise from '../views/pages/Expertise.vue';
import FeeCategory from '../views/pages/FeeCategory.vue';
import FeeStandard from '../views/pages/FeeStandard.vue';
import ArticleVue from '../views/pages/ArticleVue.vue';
import PsychologyKnowledge from '../views/pages/PsychologyKnowledge.vue';
import FM from '../views/pages/FM.vue';
import PublicWelfare from '../views/pages/PublicWelfare.vue';
import PsychologyTest from '../views/pages/PsychologyTest.vue';
import Question from '../views/pages/Question.vue';
import Reply from '../views/pages/Reply.vue';
import AppointmentList from '../views/pages/AppointmentList.vue';
import AppointmentReply from '../views/pages/AppointmentReply.vue';
import UserComment from '../views/pages/UserComment.vue';
import CourseOrder from '@/views/pages/CourseOrder.vue'
import CoursePurchase from '@/views/pages/CoursePurchase.vue'
import CourseCommunication from '@/views/pages/CourseCommunication.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: LoginView,
    },
    {
      path: '/layout',
      component: LayoutView,
      children: [
        {
          path: '/index',
          name: 'Index',
          component: Index,
          meta: { title: '首页' },
        },
        {
          path: '/system',
          name: 'System',
          meta: { title: '系统管理' },
          children: [
            { path: 'system-user', component: SystemUser, meta: { title: '系统用户管理' } },
            { path: 'normal-user', component: NormalUser, meta: { title: '普通用户管理' } },
            { path: 'announcement', component: Announcement, meta: { title: '公告管理' } },
            { path: 'company', component: CompanyVue, meta: { title: '公司管理' } },
          ],
        },
        {
          path: '/course',
          name: 'Course',
          meta: { title: '课程管理' },
          children: [
            { path: 'category', component: CourseCategory, meta: { title: '课程分类管理' } },
            { path: 'list', component: CourseList, meta: { title: '课程管理' } },
            { path: 'review', component: CourseReview, meta: { title: '课程评价管理' } },
            { path: 'communication', component: CourseCommunication, meta: { title: '课程留言管理' } },
            { path: 'order', component: CourseOrder, meta: { title: '课程订单管理' } },
            { path: 'purchase', component: CoursePurchase, meta: { title: '课程购买记录管理' } },
          ],
        },
        {
          path: '/teacher',
          name: 'Teacher',
          meta: { title: '师资管理' },
          children: [
            { path: 'consultant', component: Consultant, meta: { title: '咨询师管理' } },
            { path: 'level', component: ConsultantLevel, meta: { title: '咨询师等级管理' } },
            { path: 'expertise', component: Expertise, meta: { title: '擅长领域管理' } },
            { path: 'fee-category', component: FeeCategory, meta: { title: '收费分类管理' } },
            { path: 'fee-standard', component: FeeStandard, meta: { title: '收费标准管理' } },
          ],
        },
        {
          path: '/content',
          name: 'Content',
          meta: { title: '内容管理' },
          children: [
            { path: 'article', component: ArticleVue, meta: { title: '文章管理' } },
            { path: 'psychology-knowledge', component: PsychologyKnowledge, meta: { title: '心理知识管理' } },
            { path: 'fm', component: FM, meta: { title: 'FM管理' } },
            { path: 'public-welfare', component: PublicWelfare, meta: { title: '公益中心管理' } },
            { path: 'psychology-test', component: PsychologyTest, meta: { title: '心理测评管理' } },
          ],
        },
        {
          path: '/qa',
          name: 'QA',
          meta: { title: '心理答疑管理' },
          children: [
            { path: 'question', component: Question, meta: { title: '问题管理' } },
            { path: 'reply', component: Reply, meta: { title: '回复管理' } },
          ],
        },
        {
          path: '/appointment',
          name: 'Appointment',
          meta: { title: '咨询预约管理' },
          children: [
            { path: 'list', component: AppointmentList, meta: { title: '咨询预约管理' } },
            { path: 'reply', component: AppointmentReply, meta: { title: '咨询回复管理' } },
            { path: 'comment', component: UserComment, meta: { title: '用户评论管理' } },
          ],
        },
      ],
    },
  ],
})

export default router
